﻿using System;
using System.Windows.Forms;

namespace B.MESUI.Login.BasicData_UI
{
    public partial class EditWorkShopForm : Form
    {
        public string WorkShopId => textEditId.Text;
        public string WorkShopCode => textEditCode.Text;
        public string WorkShopName => textEditName.Text;
        public string WorkShopDesc => textEditDesc.Text;

        private string _initCode, _initName, _initDesc;

        public EditWorkShopForm(string id, string code, string name, string desc)
        {
            InitializeComponent();
            textEditId.Text = id;
            textEditCode.Text = code;
            textEditName.Text = name;
            textEditDesc.Text = desc;
            textEditId.Enabled = false; // 不允许修改ID
            _initCode = code;
            _initName = name;
            _initDesc = desc;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnReset_Click(object sender, EventArgs e)
        {
            textEditCode.Text = _initCode;
            textEditName.Text = _initName;
            textEditDesc.Text = _initDesc;
        }
    }
}